package Blog::Schema::ResultSet::Post;

use strict;
use warnings;
use base 'DBIx::Class::ResultSet';

=head2 newest_first

A predefined search that returns posts ordered from newest to oldest

=cut

sub newest_first {
  my ($self) = @_;
  return $self->search( undef, { order_by => { -desc => 'post_date' } } );
}

=head2 public

A predefined search that returns posts that have been made public

=cut

sub public {
  my ($self) = @_;
  return $self->search( 'post_date' );
}

1;
